# -*- coding: utf-8 -*-

# Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html

import scrapy


class AoinProductItem(scrapy.Item):
    '''
    证券公司直投基金
    '''
    product_id = scrapy.Field()             # 产品id
    detail_url = scrapy.Field()             # 详情页URL
    product_name = scrapy.Field()           # 产品名称
    product_code = scrapy.Field()           # 产品编码
    subsidiary = scrapy.Field()             # 直投子公司名称
    manager = scrapy.Field()                # 管理机构名称
    found_time = scrapy.Field()             # 设立日期
    record_time = scrapy.Field()            # 备案日期
    fund_type = scrapy.Field()              # 基金类型
    organization_shape = scrapy.Field()     # 组织形式
    work_stat = scrapy.Field()              # 运作状态
    trusteeship = scrapy.Field()            # 是否托管
    trustee = scrapy.Field()                # 托管人名称
    crawl_time = scrapy.Field()             # 爬取时间


class PofSubfundItem(scrapy.Item):
    '''
    证券公司私募投资基金
    '''
    product_id = scrapy.Field()             # 产品id
    detail_url = scrapy.Field()             # 详情页URL
    product_name = scrapy.Field()           # 产品名称
    product_code = scrapy.Field()           # 产品编号
    manager = scrapy.Field()                # 管理人名称
    found_time = scrapy.Field()             # 设立日期
    record_time = scrapy.Field()            # 备案日期
    fund_type = scrapy.Field()              # 基金类型
    organization_shape = scrapy.Field()     # 组织形式
    work_stat = scrapy.Field()              # 运作状态
    trusteeship = scrapy.Field()            # 是否托管
    trustee = scrapy.Field()                # 托管人名称
    crawl_time = scrapy.Field()             # 爬取时间
    user_tenant_id = scrapy.Field()         # 管理人的ID(暂时认为，未认证)


class CancelledManagerItem(scrapy.Item):
    '''
    已注销私募基金管理人名单
    '''
    manager = scrapy.Field()                # 管理人名称
    code = scrapy.Field()                   # 统一社会信用代理
    register_time = scrapy.Field()          # 登记时间
    cancel_time = scrapy.Field()            # 注销时间
    cancel_type = scrapy.Field()            # 注销类型
    crawl_time = scrapy.Field()             # 爬取时间
    user_tenant_id = scrapy.Field()         # 管理人的ID(暂时认为，未认证)


class PofPersonOrganizationListItem(scrapy.Item):
    '''
    基金从业人员资格注册信息(机构列表页)
    '''
    org_id = scrapy.Field()                 # 机构ID
    person_list_url = scrapy.Field()        # 机构下人物列表页URL
    org_name = scrapy.Field()               # 机构名称
    org_type = scrapy.Field()               # 机构类型
    worker_total = scrapy.Field()           # 员工人数
    oper_num = scrapy.Field()               # 基金从业资格总数
    sales_num = scrapy.Field()              # 基金销售业务资格总数
    fund_manager_num = scrapy.Field()       # 基金经理总数
    investment_manager_num = scrapy.Field() # 投资经理总数
    search_field = scrapy.Field()           # 搜索词
    crawl_time = scrapy.Field()             # 爬取时间
    type = scrapy.Field()                   # 类型


class PofPersonPersonListItem(scrapy.Item):
    '''
    基金从业人员资格注册信息(人物列表页和人物详情页)
    '''
    person_id =scrapy.Field()               # ID
    name = scrapy.Field()                   # 姓名
    sex = scrapy.Field()                    # 性别
    org_id = scrapy.Field()                 # 机构ID
    person_list_url = scrapy.Field()        # 人物列表页URL
    person_detail_url = scrapy.Field()      # 人物详情页URL
    org_name = scrapy.Field()               # 从业机构
    cert_code = scrapy.Field()              # 证书编号
    cert_name = scrapy.Field()              # 从业资格类别
    cert_status = scrapy.Field()            # 证书状态
    cert_obtain_time = scrapy.Field()       # 获取证书时间
    cert_status_change_times = scrapy.Field()   # 证书状态变更次数
    credit_record_num = scrapy.Field()      # 诚信记录
    # cert_status_change_record = scrapy.Field()  # 证书状态变更记录
    search_query = scrapy.Field()           # 搜索词
    crawl_time = scrapy.Field()             # 爬取时间
    type = scrapy.Field()                   # 类型


class PofPersonPersonCertStatusChangeRecordItem(scrapy.Item):
    '''
    基金从业人员资格注册信息(人物详情页证书状态变更记录)
    '''
    person_id = scrapy.Field()              # ID
    name = scrapy.Field()                   # 姓名
    org_id = scrapy.Field()                 # 机构ID
    person_detail_url = scrapy.Field()      # 人物详情页URL
    cert_code = scrapy.Field()              # 证书编号
    cert_change_time = scrapy.Field()       # 变更日期
    org_name = scrapy.Field()               # 从业机构
    cert_name = scrapy.Field()              # 从业资格类别
    cert_status = scrapy.Field()            # 证书状态
    crawl_time = scrapy.Field()             # 爬取时间
    type = scrapy.Field()                   # 类型


class PofSecuritiesItem(scrapy.Item):
    '''
    证券公司集合资管产品公示
    '''
    product_id = scrapy.Field()             # 产品ID
    detail_url = scrapy.Field()             # 详情页URL
    product_name = scrapy.Field()           # 产品名称
    product_code = scrapy.Field()           # 产品编码
    manager = scrapy.Field()                # 管理人名称
    trustee = scrapy.Field()                # 托管人名称
    record_time = scrapy.Field()            # 备案日期
    found_time = scrapy.Field()             # 成立日期
    expire_time = scrapy.Field()            # 到期日期
    investment_stat = scrapy.Field()        # 投资类型
    divide_level = scrapy.Field()           # 是否分级
    work_stat = scrapy.Field()              # 运作状态
    crawl_time = scrapy.Field()             # 爬取时间


class FundAccountItem(scrapy.Item):
    '''
    基金公司及子公司集合资管产品公示
    '''
    product_id = scrapy.Field()             # 产品ID
    detail_url = scrapy.Field()             # 详情页URL
    product_name = scrapy.Field()           # 产品名称
    product_code = scrapy.Field()           # 产品编码
    manager = scrapy.Field()                # 管理人名称
    trustee = scrapy.Field()                # 托管人名称
    record_time = scrapy.Field()            # 备案日期
    found_time = scrapy.Field()             # 成立日期
    expire_time = scrapy.Field()            # 到期日期
    investment_stat = scrapy.Field()        # 投资类型
    divide_level = scrapy.Field()           # 是否分级
    work_stat = scrapy.Field()              # 运作状态
    crawl_time = scrapy.Field()             # 爬取时间


class MutualFundManagerItem(scrapy.Item):
    '''
    公募基金管理人名录
    '''
    # line_id = scrapy.Field()              # 第几条记录
    company_name = scrapy.Field()           # 公司名称
    register_addr = scrapy.Field()          # 注册地
    office_addr = scrapy.Field()            # 办公地
    crawl_time = scrapy.Field()             # 爬取时间


class FundManagerListItem(scrapy.Item):
    '''
    私募基金管理人名录(列表页)
    '''
    manager_id = scrapy.Field()             # ID
    detail_url = scrapy.Field()             # 详情页URL
    manager_name = scrapy.Field()           # 管理人名称
    artificial_name = scrapy.Field()        # 法定代表人姓名
    org_type = scrapy.Field()               # 机构类型
    register_addr = scrapy.Field()          # 注册地
    record_code = scrapy.Field()            # 登记编号
    found_time = scrapy.Field()             # 成立时间
    record_time = scrapy.Field()            # 登记时间
    type = scrapy.Field()                   # 页面类型
    crawl_time = scrapy.Field()             # 爬取时间


class FundManagerDetailItem(scrapy.Item):
    '''
    私募基金管理人名录(详情页)
    '''
    manager_id = scrapy.Field()                         # ID
    detail_url = scrapy.Field()                         # 所在URL
    chinese_manager_name = scrapy.Field()               # 基金管理人全称(中文)
    english_manager_name = scrapy.Field()               # 基金管理人全程(英文)
    record_code = scrapy.Field()                        # 登记编号
    org_code = scrapy.Field()                           # 组织机构代码
    found_time = scrapy.Field()                         # 成立时间
    record_time = scrapy.Field()                        # 登记时间
    register_addr = scrapy.Field()                      # 注册地址
    office_addr = scrapy.Field()                        # 办公地址
    registered_capital = scrapy.Field()                 # 注册资本
    pay_capital = scrapy.Field()                        # 实缴资本
    scale = scrapy.Field()                              # 注册资本实缴比例
    enterprise_character = scrapy.Field()               # 企业性质
    org_type = scrapy.Field()                           # 机构类型
    professional_work_type = scrapy.Field()             # 业务类型
    full_time_person_num = scrapy.Field()               # 全职员工人数
    acquire_fund_person_num = scrapy.Field()            # 取得基金从业人数
    org_site = scrapy.Field()                           # 机构网址
    provide_investment_advice_tolly = scrapy.Field()    # 是否为符合提供投资建议条件的第三方机构
    # member_info = scrapy.Field()                      # 会员信息
    # legal_opinion_status = scrapy.Field()             # 法律意见书状态
    reality_control_person = scrapy.Field()             # 实际控制人
    # senior_management = scrapy.Field()                # 高管信息
    # related_party_info = scrapy.Field()               # 关联方信息(仅包含关联私募基金管理人)
    # promoter_info = scrapy.Field()                    # 出资人信息
    # product_info = scrapy.Field()                     # 产品信息
    # org_honesty_info = scrapy.Field()                 # 机构诚信信息
    type = scrapy.Field()                               # 页面类型
    crawl_time = scrapy.Field()                         # 爬取时间


class FundMangerMemberInfoItem(scrapy.Item):
    '''
    私募基金管理人名录(详情页会员信息)
    '''
    manager_id = scrapy.Field()                         # 基金管理人ID
    manager_name = scrapy.Field()                       # 基金管理人名称
    detail_url = scrapy.Field()                         # 所属URL
    is_member = scrapy.Field()                          # 是否为会员
    member_name = scrapy.Field()                        # 会员代表
    member_type = scrapy.Field()                        # 会员类型
    add_member_time = scrapy.Field()                    # 加入会员时间
    type = scrapy.Field()                               # 类型
    crawl_time = scrapy.Field()                         # 爬取时间


class LegalOpinionStatusItem(scrapy.Item):
    '''
    私募基金管理人名录(法律意见状态书信息)
    '''
    manager_id = scrapy.Field()                         # 基金管理人ID
    manager_name = scrapy.Field()                       # 基金管理人名称
    detail_url = scrapy.Field()                         # 所属URL
    legal_opinion_status = scrapy.Field()               # 法律意见书状态
    lawfirm_name = scrapy.Field()                       # 律师事务所名称
    lawyer_name = scrapy.Field()                        # 律师名称
    type = scrapy.Field()                               # 类型
    crawl_time = scrapy.Field()                         # 爬取时间


class FundManagerDetailManagementItem(scrapy.Item):
    '''
    私募基金管理人名录(详情页高管信息)
    '''
    manager_id = scrapy.Field()                         # 基金管理人ID
    manager_name = scrapy.Field()                       # 基金管理人名称
    detail_url = scrapy.Field()                         # 所属URL
    name = scrapy.Field()                               # 姓名
    position = scrapy.Field()                           # 职务
    have_fund_obtain_qualification = scrapy.Field()     # 是否有基金从业资格
    get_qualification_fashion = scrapy.Field()          # 资格获取方式
    type = scrapy.Field()                               # 类型
    crawl_time = scrapy.Field()                         # 爬取时间


class FundManagerDetailManagementWorkExperienceItem(scrapy.Item):
    '''
    私募基金管理人名录(详情页高管工作履历)
    '''
    manager_id = scrapy.Field()                         # 基金管理人ID
    manager_name = scrapy.Field()                       # 基金管理人名称
    detail_url = scrapy.Field()                         # 所属URL
    name = scrapy.Field()                               # 姓名
    time = scrapy.Field()                               # 时间
    company_name = scrapy.Field()                       # 任职单位
    department = scrapy.Field()                         # 任职部门
    position = scrapy.Field()                           # 职务
    unique_md5 = scrapy.Field()                         # 唯一索引MD5值
    type = scrapy.Field()                               # 类型
    crawl_time = scrapy.Field()                         # 爬取时间


class FundManagerRelatedPartyInfoItem(scrapy.Item):
    '''
    私募基金管理人名录(详情页关联方信息)
    '''
    manager_id = scrapy.Field()                         # 基金管理人ID
    manager_name = scrapy.Field()                       # 基金管理人名称
    detail_url = scrapy.Field()                         # 所属URL
    r_type = scrapy.Field()                             # 关联方类型
    record_code = scrapy.Field()                        # 登记编号
    org_code = scrapy.Field()                           # 组织机构代码
    related_name = scrapy.Field()                       # 关联方名称
    related_detail_url = scrapy.Field()                 # 关联方详情页URL
    related_id = scrapy.Field()                         # 关联方ID
    type = scrapy.Field()                               # 类型
    crawl_time = scrapy.Field()                         # 爬取时间


class FundManagerPromoterInfoItem(scrapy.Item):
    '''
    私募基金管理人名录(详情页出资人信息)
    '''
    manager_id = scrapy.Field()                         # 基金管理人ID
    manager_name = scrapy.Field()                       # 基金管理人名称
    detail_url = scrapy.Field()                         # 所属URL
    name = scrapy.Field()                               # 姓名/名称
    scale = scrapy.Field()                              # 认缴比例
    type = scrapy.Field()                               # 类型
    crawl_time = scrapy.Field()                         # 爬取时间


class FundManagerImplementBeforeItem(scrapy.Item):
    '''
    私募基金管理人名录(产品信息:暂行办法实施前成立的基金)
    '''
    manager_id = scrapy.Field()                         # 基金管理人ID
    manager_name = scrapy.Field()                       # 基金管理人名称
    detail_url = scrapy.Field()                         # 所属URL
    company_name = scrapy.Field()                       # 名称
    company_detail_url = scrapy.Field()                 # 公司详情URL
    company_id = scrapy.Field()                         # 公司ID
    current_month_report = scrapy.Field()               # 当月月报
    quarter_report = scrapy.Field()                     # 季报
    half_a_year_report = scrapy.Field()                 # 半年报
    year_report = scrapy.Field()                        # 年报
    type = scrapy.Field()                               # 类型
    crawl_time = scrapy.Field()                         # 爬取时间


class FundManagerImplementAfterItem(scrapy.Item):
    '''
    私募基金管理人名录(产品信息:暂行办法实施后成立的基金)
    '''
    manager_id = scrapy.Field()                         # 基金管理人ID
    manager_name = scrapy.Field()                       # 基金管理人名称
    detail_url = scrapy.Field()                         # 所属URL
    company_name = scrapy.Field()                       # 名称
    company_detail_url = scrapy.Field()                 # 公司详情URL
    company_id = scrapy.Field()                         # 公司ID
    current_month_report = scrapy.Field()               # 当月月报
    quarter_report = scrapy.Field()                     # 季报
    half_a_year_report = scrapy.Field()                 # 半年报
    year_report = scrapy.Field()                        # 年报
    type = scrapy.Field()                               # 类型
    crawl_time = scrapy.Field()                         # 爬取时间


class FundManagerInvestAdviserProductItem(scrapy.Item):
    '''
    私募基金管理人名录(产品信息:投资顾问类产品)
    '''
    manager_id = scrapy.Field()                         # 基金管理人ID
    manager_name = scrapy.Field()                       # 基金管理人名称
    detail_url = scrapy.Field()                         # 所属URL
    company_name = scrapy.Field()                       # 名称
    company_detail_url = scrapy.Field()                 # 公司详情URL
    company_id = scrapy.Field()                         # 公司ID
    current_month_report = scrapy.Field()               # 当月月报
    quarter_report = scrapy.Field()                     # 季报
    half_a_year_report = scrapy.Field()                 # 半年报
    year_report = scrapy.Field()                        # 年报
    type = scrapy.Field()                               # 类型
    crawl_time = scrapy.Field()                         # 爬取时间


class FundManagerOrgHonestyInfoItem(scrapy.Item):
    '''
    私募基金管理人名录(诚信信息)
    '''
    manager_id = scrapy.Field()                         # 基金管理人ID
    manager_name = scrapy.Field()                       # 基金管理人名称
    detail_url = scrapy.Field()                         # 所属URL
    org_info_end_update_time = scrapy.Field()           # 机构信息最后更新时间
    prompt_info = scrapy.Field()                        # 特别提示信息
    honesty_info = scrapy.Field()                       # 机构诚信信息
    type = scrapy.Field()                               # 类型
    crawl_time = scrapy.Field()                         # 爬取时间

